package com.lyf.design.learn.designmodel.flyweight;

import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @AUTHOR LYF
 * @DATE 2022/6/9
 * @VERSION 1.0
 * @DESC
 */
class Bullet{
    private String name;
    private Boolean isLiving;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getLiving() {
        return isLiving;
    }

    public void setLiving(Boolean living) {
        isLiving = living;
    }
}
class BulletPool{
    static List<Bullet> pool;
    static {
        for(int i=0;i<5;i++){
            pool.add(new Bullet());
        }
    }
    static Bullet getBullet(){
        for(Bullet bullet: pool)
            if(!bullet.getLiving())
                return bullet;
        return new Bullet();
    }
}

public class BulletinDemo {
    public static void main(String[] args) {
        //ThreadPoolExecutor
        //



    }


}

